package org.workplicity.android.cia.util;

import org.workplicity.android.cia.R;

import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.view.View;

public class MyDragShadowBuilder extends View.DragShadowBuilder {
    private Drawable mShadow;

    public MyDragShadowBuilder(View v) {
        super(v);

        final TypedArray a = v.getContext().obtainStyledAttributes(R.styleable.AppTheme);
        mShadow = a.getDrawable(R.styleable.AppTheme_listDragShadowBackground);
        mShadow.setCallback(v);
        mShadow.setBounds(0, 0, v.getWidth(), v.getHeight());
        a.recycle();
    }

    @Override
    public void onDrawShadow(Canvas canvas) {
        super.onDrawShadow(canvas);
        mShadow.draw(canvas);
        getView().draw(canvas);
    }
}